package core;


/**
 *
 * @author Michal Horak
 */
public class Point {
    
    public int x, y;

    public Point(double x, double y) {
        
        this.x = (int) roundToDecimals(x, 1);
        this.y = (int) roundToDecimals(y, 1);
        
        
    }
    
    final double roundToDecimals(double d, int c) {
        int temp = (int) ((d * Math.pow(10, c)));
        return (((double) temp) / Math.pow(10, c));
    }

    @Override
    public String toString() {
        return "Pozice: " + x + " " + y;
    }

    @Override
    public boolean equals(Object obj) {
        boolean result = false;
        if (obj instanceof Point){
            Point p = (Point) obj;
            result = (this.x == p.x && this.y == p.y);
            
        }
        
        
        return result;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 61 * hash + this.x;
        hash = 61 * hash + this.y;
        return hash;
    }
    
    
    
    
    
}
